{% load seahub_tags i18n %}
<div class="repo-file-list-topbar">
    <p class="path fleft">
    {% for name, link in zipped %}
    {% if forloop.first or not forloop.last %}
    <a href="{{ SITE_ROOT }}repo/{{ repo.id }}/?p={{ link|urlencode }}" class="dir-link normal">{{ name }}</a> /    
    {% else %}
    <span id="cur-dir-name">{{ name }}</span> /
    {% endif %}
    {% endfor %}
    </p>
    <div class="repo-op fright">
        {% if user_perm == 'rw' %}

        {% if repo.encrypted and repo.enc_version == 2 and not server_crypto %}
            <button id="upload-file" class="op-btn"><span class="icon-upload-alt"></span>{% trans "Upload"%}</button>
        {% else %}
            {% if no_quota %}
            <button id="upload-file" class="op-btn"><span class="icon-upload-alt"></span>{% trans "Upload"%}</button>
            {% else %}
            <div id="upload-file" class="op-btn upload-file-btn">
                <span class="icon-upload-alt"></span><span>{% trans "Upload"%}</span>
                <input type="file" name="file" multiple />
            </div>
                {% if enable_upload_folder %}
            <ul id="upload-menu" class="hide">
                <li class="item">
                <span>{% trans "Upload Files" %}</span>
                <input type="file" name="file" multiple />
                </li>
                <li class="item">
                <span>{% trans "Upload Folder" %}</span>
                <input type="file" name="file" multiple directory webkitdirectory />
                </li>
            </ul>
                {% endif %}
            {% endif %}
        {% endif %}
        <button id="add-new-dir" class="op-btn"><span class="icon-plus-sign-alt"></span>{% trans "New Directory"%}</button>
        {% if repo.encrypted and repo.enc_version == 2 and not server_crypto %}
        {% else %}
        <button id="add-new-file" class="op-btn"><span class="icon-plus-sign-alt"></span>{% trans "New File"%}</button>
        {% endif %}
        {% endif %}

        {% if path != '/' %}
        {% if not repo.encrypted %}
        <button data-url="{% url 'get_shared_link' %}?repo_id={{ repo.id }}&p={{ path|urlencode }}&type=d" data-link="{{ dir_shared_link }}" data-token="{{fileshare.token}}" data-upload-url="{% url 'get_shared_upload_link' %}?repo_id={{ repo.id }}&p={{ path|urlencode }}" data-upload-link="{{ dir_shared_upload_link }}" data-upload-token="{{ uploadlink.token }}" class="op-btn" id="share-cur-dir"><span class="sf-icon-share"></span>{% trans "Share"%}</button>
        {% endif %}
        {% endif %}
    </div>
    <div id="repo-latest-commit" class="clear">
        {% include 'snippets/current_commit.html' %}
    </div>
</div>

<table class="repo-file-list">
    <tr>
        <th class="select">
            <span class="checkbox"><input type="checkbox" class="checkbox-orig" /></span>
        </th>
        <th class="star"></th>
        <th class="dirent-icon"></th>
        <th><span class="dirent-name">{% trans "Name"%} <span id="name-down" class="icon-caret-up cspt"></span> <span id="name-up" class="icon-caret-down cspt hide"></span></span></th>
        <th class="dirent-size">{% trans "Size"%}</th>
        <th class="dirent-update">{% trans "Last Update" %} <span id="time-up" class="icon-caret-up cspt hide"></span> <span id="time-down" class="icon-caret-down cspt"></span></th>
        <th class="dirent-op">{% trans "Operations"%}</th>
    </tr>
    {% include 'snippets/repo_dirents.html' %}
</table>
{% if dirent_more %}
<img class="dirent-more loading-tip" src="{{MEDIA_URL}}img/loading-icon.gif" alt="{% trans 'Loading...' %}" data-start="{{more_start}}" />
{% endif %}
